package cnu.cse.crawler.xedata;

import java.util.ArrayList;
import java.util.Collections;

public class XeBoard
{
	public static final int EXAMPLE = 0;

	private String baseUrl;
	private String path;
	private int pageCount;
	private ArrayList<String> pagePaths;
	private int documentCount;
	private ArrayList<XeDocument> documents;
	
	public XeBoard(String baseUrl, String path, int pageCount, int documentCount)
	{
		this.baseUrl = baseUrl;
		this.path = path;
		this.pageCount = pageCount;
		this.documentCount = documentCount;
		this.pagePaths = new ArrayList<String>(this.pageCount);
		this.documents = new ArrayList<XeDocument>(this.documentCount);
	}
	
	public String getBaseUrl()
	{
		return baseUrl;
	}
	
	public String getPath() 
	{
		return path;
	}

	public int getPageCount() 
	{
		return pageCount;
	}
	
	public int getRealPageCount()
	{
		return pagePaths.size();
	}

	public int getDocumentCount() 
	{
		return documentCount;
	}
	
	public int getRealDocumentCount()
	{
		return documents.size();
	}
		
	public void addPagePath(String pagePath)
	{
		pagePaths.add(pagePath);
	}
	
	public void addDocument(XeDocument document)
	{
		documents.add(document);
	}
	
	public String getPagePath(int index)
	{
		if (index > -1 && index < pageCount)
		{
			return pagePaths.get(index);
		}
		
		return null;
	}
		
	public XeDocument getDocument(int index)
	{
		if (index > -1 && index < documentCount)
		{
			return documents.get(index);
		}
		
		return null;
	}
	
	public void reverseDocumentOrder()
	{
		Collections.reverse(documents);
	}
	
	
	
}
